/*
* Mentioned DB1 as your Compared Database here
*/
;WITH 
SrcCols AS (
               SELECT Table_NAme AS TableName, C.COLUMN_NAME AS ColName, c.*
               FROM   mainserver.DB1.information_schema.columns c
           ),
DesCols AS (
               SELECT Table_NAme AS TableName, C.COLUMN_NAME AS ColName, c.*
               FROM   information_schema.columns c
           )
SELECT --s.Tablename,s.colname,
       Createstmt = 'If Col_Length(''' + s.Tablename + ''',''' + s.ColName + 
       ''') Is NULL
	ALTER TABLE ' + s.Tablename + ' ADD ' + s.ColName + ' ' +
       s.data_type + CASE s.data_type
                          WHEN 'sql_variant' THEN ''
                          WHEN 'text' THEN ''
                          WHEN 'decimal' THEN '(' + CAST (s.numeric_precision_radix AS VARCHAR) +
                               ', ' + CAST (s.numeric_scale AS VARCHAR) + ')'
                          ELSE COALESCE(
                                   '(' + CASE 
                                              WHEN s.character_maximum_length = -1 THEN 'MAX'
                                              ELSE CAST (s.character_maximum_length AS VARCHAR)
                                         END + ')', ''
                               )
                     END + ' ' + CASE 
                                                    WHEN s.is_nullable = 'YES' THEN 'NULL'
                                                    ELSE 'NOT NULL'
                                               END + '
GO'
FROM   Srccols s
       LEFT OUTER JOIN descols d
            ON  s.Tablename = d.Tablename AND s.ColName = d.ColName
WHERE  d.tablename IS NULL AND EXISTS (
           SELECT 1
           FROM   descols dc
           WHERE  dc.Tablename = s.Tablename
       )
       
       --s.Tablename ='Activity' AND 
       
       
       
